<?php

namespace App\Http\Requests\Api\V1_9_3;

use Illuminate\Foundation\Http\FormRequest;

class CreditCardHandleApplyRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'mobile' => 'required|regex:/^1[3456789]{1}\d{9}$/',
            'true_name' => 'required',
            'id_card' => 'required',
            'verification_code' => 'required|min:4|max:4|regex:/^([0-9]+$)/',
            'credit_card_handle_id' => 'required',
        ];
    }

    public function messages()
    {
        return [
            'mobile.required' => '手机号码不能为空',
            'mobile.regex' => '手机号码格式不正确',
            'true_name.required' => '真实姓名不能为空',
            'id_card.required' => '身份证号码不能为空',
            'verification_code.required' => '验证码不能为空',
            'verification_code.min' => '验证码至少4位',
            'verification_code.max' => '验证码不能大于4位',
            'verification_code.regex' => '验证码必须是4位纯数字',
            'credit_card_handle_id.required' => '办理信用卡id不能为空',
        ];
    }
}
